home *** CD-ROM | disk | FTP | other *** search
- BEGIN {
- #{{{}}}
- # {{{ init internal vars
- start=256
- i=start
- SMALL_VT= ".sp .3";
- # }}}
-
- # {{{ init fixed cmd arg range
- cmd_range=8
- # }}}
-
- # {{{ print auto-gen tag
- printf(".\\%c generated automatically, containing OCL token table\n",34)
- # }}}
- # {{{ start table
- printf(".TS\n")
- printf("center tab(@);\n")
- printf("l r l.\n")
- # }}}
- # {{{ entry for NOP
- printf("\\fBO_NOP\\fP@%d@COM\n",i)
- printf(" no operation@@*\n")
- printf("%s\n",SMALL_VT);
- # }}}
- }
- #{{{ set fixed cmd arg range
- /^#define +FIXED_COMMAND_RANGE/ {
- cmd_range=$3
- }
- #}}}
- #{{{ set types for command and fixed command
- $3=="COM" || $3=="COM_I" || $3=="COM_II" || $3=="COM_P" || $3=="COM_IP" || $3=="COM_IIP" { typ=$3;fix_typ="";arg="" }
- $3=="COM_A" { typ="COM_A";fix_typ="COM";arg=" +arg" }
- $3=="COM_ID" { typ="COM_II";fix_typ="COM_I";arg="arg1" }
- #}}}
- substr($1,1,1)!="#" && $3!="OCL-KEY" && $3!="OPP-KEY" {
- # {{{ decode permission
- perm=""
- if ($2=="KT_DUMMY")
- perm="*"
- else if ($2=="KT_NONE")
- perm="-"
- else {
- for (l=3;l<=length($2);l++) {
- if (substr($2,l,1)=="B")
- perm= perm "V"
- else if (substr($2,l,1)=="P")
- perm= perm "P"
- else if (substr($2,l,1)=="S")
- perm= perm "F"
- else if (substr($2,l,1)=="s")
- perm= perm "f"
- }
- }
- # }}}
- # {{{ get text for table entry
- if ($5!="" || $4=="NONE") {
- txt=""
- for (t=5;t<=NF;t++)
- txt=txt " " $t
- } else
- txt=" \\fB"$4"\\fP"
- # }}}
- # {{{ get additional arg and type, maybe print auto commands
- if ($3=="COM_ID" || $3=="COM_A" || $3=="COM_D") {
- print("\\fB"$1"_M\\fP\\fIx\\fP@"++i+cmd_range"-\\fIx\\fP,0<\\fIx\\fP<="cmd_range"@"fix_typ)
- print(txt" \-\\fIx\\fP@@"perm)
- i+=cmd_range-1
- print("\\fB"$1"_\\fP\\fIx\\fP@"++i"+\\fIx\\fP,0<=\\fIx\\fP<="cmd_range"@"fix_typ)
- print(txt" \\fIx\\fP@@"perm)
- i+=cmd_range
- }
- # }}}
- print("\\fB"$1"\\fP@"++i"@"typ)
- print(txt arg"@@"perm)
- print(SMALL_VT)
- }
- END {
- print("\\fBO_CALL_FIX\\fP \\fIx\\fP@\\fIx\\fP+"i",\\fIx\\fP>=0@COM")
- print(" call the OCL-macro \\fIx\\fP@@*")
- print(".TE")
- print(".LP")
- print("Tokens lower than "start" represent the corresponding characters.")
- }
-